﻿namespace Gift.WebApp
{
    using System;
    using System.Configuration;
    using System.Web;
    using System.Xml;

    public class AlipayConfig
    {
        private string input_charset = "";
        private string key = "";
        private string mainname = "";
        private string notify_url = "";
        private string partner = "";
        private string return_url = "";
        private string seller_email = "";
        private string show_url = "";
        private string sign_type = "";
        private string transport = "";

        public AlipayConfig()
        {
            XmlDocument document = new XmlDocument();
            document.Load(HttpContext.Current.Server.MapPath("/cn/xml/payment.xml"));
            XmlNodeList childNodes = document.SelectSingleNode("paymentMethod").ChildNodes;
            foreach (XmlNode node in childNodes)
            {
                XmlElement element = (XmlElement) node;
                if (element.GetAttribute("id") == "1")
                {
                    this.partner = element.GetAttribute("partner");
                    this.key = element.GetAttribute("key");
                    this.seller_email = element.GetAttribute("seller_email");
                    this.mainname = element.GetAttribute("mainname");
                    break;
                }
            }
            string str = ConfigurationManager.AppSettings["Area"].ToString();
            this.return_url = str + "/cn/member_center/expense_records.html";
            this.notify_url = str + "/alipay/notify_url.aspx";
            this.show_url = str + "/cn/goods_list.html";
            this.input_charset = "utf-8";
            this.sign_type = "MD5";
            this.transport = "https";
        }

        public string Input_charset
        {
            get
            {
                return this.input_charset;
            }
            set
            {
                this.input_charset = value;
            }
        }

        public string Key
        {
            get
            {
                return this.key;
            }
            set
            {
                this.key = value;
            }
        }

        public string Mainname
        {
            get
            {
                return this.mainname;
            }
            set
            {
                this.mainname = value;
            }
        }

        public string Notify_url
        {
            get
            {
                return this.notify_url;
            }
            set
            {
                this.notify_url = value;
            }
        }

        public string Partner
        {
            get
            {
                return this.partner;
            }
            set
            {
                this.partner = value;
            }
        }

        public string Return_url
        {
            get
            {
                return this.return_url;
            }
            set
            {
                this.return_url = value;
            }
        }

        public string Seller_email
        {
            get
            {
                return this.seller_email;
            }
            set
            {
                this.seller_email = value;
            }
        }

        public string Show_url
        {
            get
            {
                return this.show_url;
            }
            set
            {
                this.show_url = value;
            }
        }

        public string Sign_type
        {
            get
            {
                return this.sign_type;
            }
            set
            {
                this.sign_type = value;
            }
        }

        public string Transport
        {
            get
            {
                return this.transport;
            }
            set
            {
                this.transport = value;
            }
        }
    }
}

